#!/bin/bash
#循环最近n天
for i in `seq 0 6`;do
        date=`date -d "20161201 +$i day" "+%Y-%m-%d"`;
done

exit 0
today=`date "+%Y%m%d"`
start="20170101"
while [ $start -lt $today ];
do
    echo "$start"
    start=`date -d "$start +1 day" "+%Y%m%d"`
done